<?php
/**
 * @package panel
 * @subpackage panel.environment.loggers
 */
/**
 * Logger to console log file
 * @author Dmitry Bakaleinik (code)
 */
class panel__logger__console
	implements maf__i__singletone {

	/**
	 * @var maf__fso__file
	 */
	protected $file;

	/**
	 * @return panel__logger__console
	 */
	static public function getInstance() {

		static $instance;

		if( !isset($instance) ) {
			$instance = new self; }

		return $instance;

	}	# Function

	protected function __clone() {
	}	# Function

	protected function __sleep() {
	}	# Function

	protected function __wakeup() {
	}	# Function

	protected function __construct() {

		$this->file = new maf__fso__file(PANEL__PATH__LOGS . "/panel.log");

	}	# Function

	public function log($_message_) {

		switch( TRUE ) {

		case is_string($_message_):
			break;

		case ($_message_ instanceof exception):
			$_message_ = $_message_->__toString();
			break;

		default:
			$_message_ = var_export($_message_, TRUE);
			break;
		}	# switch

		$this->file->appendContents( html_entity_decode($_message_) . "\n" );

	}	# Function

}	# Class

/* EOF */